package com.example.handler;

import com.example.enums.ResultEnum;

/**
 *@description 处理自定义的业务异常
 *  BaseException 类继承 RuntimeException
 */
public class BaseException extends RuntimeException {

    private Integer code;  //错误码

    // 给自定义的业务异常类用的方法
    public BaseException(ResultEnum responseCodeEnum) {
        this(responseCodeEnum.getMessage(), responseCodeEnum.getCode());
    }

    private BaseException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
